package com.ljy.tkmodel.job;

import lombok.extern.slf4j.Slf4j;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RoomJob extends QuartzJobBean {
    @Autowired
    StringRedisTemplate redisTemplate;
    //定义消息任务
    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        JobDataMap mergedJobDataMap = jobExecutionContext.getMergedJobDataMap();
        //发送消息部分

//        String id = (String) mergedJobDataMap.get("id");
//        Long startDate = (Long) mergedJobDataMap.get("startDate");
//       // log.info(id+"你好，推送消息已发送：时间"+startDate.toString());
//        log.info("你好，推送消息已发送：时间");
//        redisTemplate.opsForValue().set("RoomId",id);
//        redisTemplate.opsForValue().set("startDate",startDate.toString());
    }
}
